﻿function $(ele) {
    return document.getElementById(ele);
}

function loadMsg() {
    var dt = nsmsg.GetCaseList().value;
    if (dt == null || dt.Rows.length == 0) {
        $("msg_content").innerHTML = "暂无待处理任务";
        return;
    }
    var count = dt.Rows.length;
    var html = " <ul>";

    for (var i = 0; i < count; i++) {
        html += "<li onclick=\"opencase(this)\" wcid=\"" + dt.Rows[i]["CID"] + "\" waid=\"" + dt.Rows[i]["AID"] + "\">" + dt.Rows[i]["CTT"] + "</li>";
    }
    html += "</ul>";
    $("msg_content").innerHTML = html;
}

addLoadFuc(loadMsg);

function opencase(ipt) {
    var waid = ipt.getAttribute("waid");

    if (waid == null) return;
    var v = nsmsg.OpenNewPage(waid).value;
    if (v == null || v.Rows.length == 0) {
        alert("没有数据,无法打开");
        return;
    }
    var url = v.Rows[0]["URL"] + "?act=" + v.Rows[0]["ACTID"];
    window.parent.document.getElementById("right").src = url;
}